﻿using System;
using System.Windows.Media;
using Microsoft.SmallBasic.Library;

namespace SmallBasicFun
{
    public static class ColorHelper
    {
        public static bool IsColor(this Primitive variable)
        {
            return variable.ToString().StartsWith("#");
        }
        public static Color AsColor(this Primitive variable)
        {
            try
            {
                return (Color)ColorConverter.ConvertFromString(variable);
            }
            catch (Exception)
            {
            }
            return System.Windows.Media.Colors.Black;

        }
    }
}